package com.xuyiwei.mayi.test;

import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * Created by xuyiwei on 2019/4/13.
 */
public class ConcurrentLinkedQequeDemo {
    public static void main(String[] args) {
        ConcurrentLinkedQueue<Integer> queue = new ConcurrentLinkedQueue<>();
        for(int i=0;i<100;i++){
            queue.add(i);
        }

        for(int i=0;i<10;i++) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    while (queue.size()>0){
                        System.out.println(queue.poll());

                    }
                }
            });
            thread.start();
        }

    }
}
